<?php 
  // Start the SESSION vars
	if (session_id() == "")
	{
		session_start();
	}
	// Include configuration variables
  include_once('/var/www/gde-1.0/htdocs/config.php');
  // Include the login top.php
  include_once(Config::base_path.Config::top_login_php); 
  // Include the login nav.php
  include_once(Config::base_path.Config::nav_login_php); 
   // Include builder functions
  include_once(Config::base_path.Config::builder_func_path."builder.func.php");  
  
  if(isset($_POST['selected_table']))
  {
    // Set the session var from the POST by builder-1.php
    $_SESSION['selected_table'] = $_POST['selected_table'];
  
    // Building inner joins here is an option as apposed to the admin console but could cost time
    // buildInnerJoins($_SESSION['selected_database'],$_SESSION['selected_table']);
  
    // Obtain the users selected fields for the selected tables used for query builder
    buildFieldQuery($_SESSION['selected_database'],$_SESSION['selected_table']);
  }
  else 
  {
    message2html("You must select table(s)!",red);
    message2html("You will be redirected",black);
    message2redirect("","/gde-1.0/templates/logged-in/builder.php",3);
  }
  
 ?>

